function replacementFNHandler(sender, languageName,loader) {
    var senderAfter = jQuery("#" + sender);
    if (jQuery(senderAfter).val().length < 2) {
        jQuery("#tableContainer").html('');
        jQuery("#ajaxStatementInfo").html(getTranslation("ajaxSelectThreeChars", languageName)).show();
        return;
    }
	jQuery("#tableContainer").html('');
	jQuery("#filterContainer").html('');
	jQuery("#ajaxStatementInfo").html("<img src=\"" + loader + "\">").show();
    var senderValue = jQuery(senderAfter).val();
    if (senderValue) {
        //var trimmedsenderValue = senderValue.split(' ').join('');
		//trimmedsenderValue = trimmedsenderValue.split('-').join('');
		//trimmedsenderValue = trimmedsenderValue.split('/').join('');
		var trimmedsenderValue = senderValue;
		jQuery.ajax({
		    type: "POST",
		    url: "../../../Ajax/ReplacementFilterList?value=" + trimmedsenderValue + "&languageName=" + languageName,
		    contentType: "application/json; charset=utf-8",
		    dataType: "text",
		    data: "{}",
		    success: function(res) {
		    jQuery('#ajaxStatementInfo').hide();
		    jQuery('#tableContainer').html("");
		    jQuery('#filterContainer').html("");
		      //  console.log(res);
		        jQuery('#tableContainer').html(res);
		        setOnClick();


		        /*   jQuery('#ajaxStatementInfo').hide();
		        jQuery('#tableContainer').html("");
		        jQuery('#filterContainer').html("");
		        if (res.bindings[0]['com'] == "noRep") {
		        jQuery('#ajaxStatementInfo').html(getTranslation("noReplacement", languageName)).show();
		        } else {
		        jQuery('#tableContainer').append(CreateTableView(res.bindings, 'crossTable', true, languageName, trimmedsenderValue)).fadeIn('fast', function() {
		        if (jQuery('.crossTable tbody tr').size() == 1) {
		        jQuery('.crossTable tbody tr td').first().click();
		        }
		        });
		        }*/
		    }
		});
    }
}
/*
function CreateTableView(objArray, theme, enableHeader, languageName, trimmedsenderValue) {
    // set optional theme parameter
    if (theme === undefined) {
        theme = 'mediumTable'; //default theme
    }

    if (enableHeader === undefined) {
        enableHeader = true; //default enable headers
    }

    // If the returned data is an object do nothing, else try to parse
    var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
    
    var str = '<table class="' + theme + '">';

    // table head
    if (enableHeader) {
        str += '<thead><tr>';
        for (var index in array[0]) {
            if (index == "repFilterProd" || index == "repId") {
                str += '<th style="display: none;" scope="col">' + index + '</th>';
            } else {
                str += '<th scope="col">' + index + '</th>';
            }
        }
        str += '</tr></thead>';
    }

    // table body
    str += '<tbody>';
    
    for (var i = 0; i < array.length; i++) {
        str += (i % 2 == 0) ? '<tr class="alt">' : '<tr>';
        for (var index in array[i]) {
            if (index == "repFilterProd" || index == "repId") {
                str += '<td style="display: none" onclick="makeReplacementActive(this, ' + array[i]["repId"] + ', \'' + languageName + '\', \'' + array[i]["repFilterProd"] + '\');">' + array[i][index] + '</td>';
            } else {
            if (index == "Filtr obcy") {
					var foreignNumber = array[i]['Filtr obcy'];
					if (foreignNumber.indexOf(trimmedsenderValue.toUpperCase()) >= 0) {
						foreignNumber = foreignNumber.replace(trimmedsenderValue.toUpperCase(), "<strong>"+ trimmedsenderValue.toUpperCase() +"</strong>");
						}
					str += '<td onclick="makeReplacementActive(this, ' + array[i]["repId"] + ', \'' + languageName + '\', \''+ array[i]["repFilterProd"] + '\');">' + foreignNumber + '</td>';	
				} else {
					str += '<td onclick="makeReplacementActive(this, ' + array[i]["repId"] + ', \'' + languageName + '\', \''+ array[i]["repFilterProd"] + '\');">' + array[i][index] + '</td>';
				}
            }
        }
        str += '</tr>';
    }
    str += '</tbody>'
    str += '</table>';
    return str;
}

function makeReplacementActive(sender, filterId, languageName, producer) {
    jQuery("table.crossTable tr").find("li.active").removeClass('active');
    jQuery("table.crossTable").children('tbody').find('tr.active').removeClass('active');
    jQuery(sender).parent().toggleClass('active');
    doSingleReplacementFilter('filterContainer', filterId, languageName, producer);
	//scroll(0, 420);
}

function doSingleReplacementFilter(filterSingleDiv, filterId, languageName, producer) {
    producer = producer.toLowerCase();
    jQuery("#ajaxStatementInfo").hide();
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var url = "../../../../Ajax/ReplacementFilterDescription.aspx?filterId=" + filterId + "&producer=" + producer + "&languageName=" + languageName;
        httpObject.open("GET", url, true);
        httpObject.onreadystatechange = function() {
            if (httpObject.readyState == (1 || 0)) {
                jQuery("#" + filterSingleDiv).css('height', '300px');
                jQuery("#" + filterSingleDiv).css('text-align', 'center');
                jQuery("#" + filterSingleDiv).html("<img style=\"margin-top: 145px;\" src=\"../../../Content/images/ajax-loader.gif\" alt=\"loading\">");
            }
            if (httpObject.readyState == 4) {
                jQuery("#" + filterSingleDiv).css('height', 'auto');
                jQuery("#" + filterSingleDiv).css('text-align', 'left');
                jQuery("#" + filterSingleDiv).html(httpObject.responseText);
                if (jQuery(".popupScroll").length > 0) {
                    jQuery(".popupScroll").mCustomScrollbar({
                        advanced: {
                            updateOnContentResize: true
                        }
                    });
                }                
            } //if state
        }      //func
        httpObject.send(null);
    } //if 	   
}*/